package com.ccjq.shosestore.product.util;

import com.ccjq.shosestore.core.dbmanager.DbConnection;
import com.ccjq.shosestore.product.model.ProductModel;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;


public class GetScrollList {
	public List<ProductModel> GetList(String sql) {
		List<ProductModel> productlist = new ArrayList<ProductModel>();
		try {
			Connection conn = DbConnection.getConnection();
			Statement stat = conn.createStatement();
			ResultSet re = stat.executeQuery(sql);
			while (re.next()) {
				ProductModel po = new ProductModel();
				po.setDescription(re.getString(1));
				po.setProduct_id(re.getString(2));
				po.setImgpath(re.getString(3)); 
				System.out.println("///"+po.getImgpath());
				
				productlist.add(po);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return productlist;
	}

}
